#ifndef DIAGRAM_H_
#define DIAGRAM_H_
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <map>
#include <fstream>
#include "model/Component.h"
#include "model/Connector.h"
#include "gui/VisualComponents/ArrowHead.h"

class Diagram {

protected:
	std::vector<Component*> m_components;

	std::string m_name, m_path;
	unsigned m_sizeX;
	unsigned m_sizeY;
	unsigned m_lastAttributeId;
	virtual void serializeConnectedComponents(std::vector<Connector*> connectors, XmlWriter & writer) = 0;
	ArrowHead::ArrowStyle m_arrow_style;

public:
	Diagram(const std::string & name = "unnamed");
	virtual ~Diagram();

	std::string getName();
	std::string getPath();

	void setPath(const std::string & path);
	virtual int getType() = 0;

    void addComponent(Component *component);
    void removeComponent(Component*);


    unsigned getSizeX() const;
    unsigned getSizeY() const;
    void setSize(unsigned sizeX, unsigned sizeY);
    void setName(const std::string & name);

    /*Funciones que quizás puedan cambiar*/
    std::vector<Component*>* getComponents();
    int getId(Component* component);

    /*Funciones que cambian dependiendo el tipo de diagrama*/
    virtual void serializeConnectedComponents(Component* component, XmlWriter & writer)=0;
    virtual void validateDiagram(std::fstream & filestr)=0;

	ArrowHead::ArrowStyle getArrowStyle() const;
	void setArrowStyle(ArrowHead::ArrowStyle arrowStyle);
};

#endif /* DIAGRAMO_H_ */
